import { create } from 'zustand'
import { LocaleType, LocaleStoreType, LocaleOptions } from '@/interface/common/LocaleType'
import zhCn from '@/locale/zh-cn'
import enUS from '@/locale/en-us'


const useLocalStore = create<LocaleStoreType>((set) => ({
  value: 'zh-cn',
  dict: zhCn,
  setValue: (v: string) => {
    set((state) => ({ value: v }))
    if (v == 'zh-cn')
      set((state) => ({ dict: zhCn }))
    else if(v=='en-us'){
      set((state) => ({ dict: enUS }))
    }
  }
}))

export default useLocalStore
